package cn.south.campus.business.model.vo;

import cn.south.campus.business.model.entity.Student;
import cn.south.campus.common.model.vo.BaseVO;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * <p>
 *
 * </p>
 *
 * @author chow
 * @since 2025/2/12 14:10
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class StudentVo extends BaseVO {
    /**
     * 用户id
     */
    private Long userId;

    /**
     * 姓名
     */
    private String name;

    /**
     * 学号
     */
    private String studentNo;

    /**
     * 学院
     */
    private String college;

    /**
     * 专业
     */
    private String major;

    /**
     * 班级
     */
    private String classes;

    /**
     * 学生证图片
     */
    private String pic;

    /**
     * 学生认证状态
     */
    private Integer status;


    public static StudentVo convert(Student student) {
        if (student == null) {
            return null;
        }
        StudentVo vo = new StudentVo();
        vo.setId(student.getId());
        vo.setUserId(student.getUserId());
        vo.setName(student.getName());
        vo.setStudentNo(student.getStudentNo());
        vo.setCollege(student.getCollege());
        vo.setMajor(student.getMajor());
        vo.setClasses(student.getClasses());
        vo.setPic(student.getPic());
        vo.setStatus(student.getStatus());
        return vo;
    }

    public static Student convert(StudentVo vo) {
        if (vo == null) {
            return null;
        }
        Student student = new Student();
        student.setId(vo.getId());
        student.setUserId(vo.getUserId());
        student.setName(vo.getName());
        student.setStudentNo(vo.getStudentNo());
        student.setCollege(vo.getCollege());
        student.setMajor(vo.getMajor());
        student.setClasses(vo.getClasses());
        student.setPic(vo.getPic());
        return student;
    }
}
